package com.lvyou.ctrls;

import com.lvyou.entity.GoodsModel;
import com.lvyou.service.GoodsSrvImpl;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

//商品
@Controller
@RequestMapping("/goods")
public class GoodsCtrl {
    @Resource
    private GoodsSrvImpl srv;

    @RequestMapping("/query")
//    public ModelAndView query() {
    public ModelAndView list() {
        /*
        视图名
        传递给jsp的数据
         */
        ModelAndView mv = new ModelAndView();
        List<GoodsModel> list=srv.query();
        mv.setViewName("goodsList");
        mv.addObject("list",list);
        return mv;
    }

    @RequestMapping("/showById")
    public ModelAndView showById(String id){
//    public ModelAndView queryById(){
        return null;
    }
}
